package com.imooc.bigdata.hadoop.mr.project.Utils;/**
 * Created by luochangyong on 2019/8/16.
 */

import org.apache.commons.lang.StringUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 */
public class ContentUtils {
    public static String getPageId(String url){
        String pageId = "-";
        if(StringUtils.isBlank(url)){
            return pageId;
        }

        Pattern pattern = Pattern.compile("pageId=[0-9]+");
        Matcher matcher = pattern.matcher(url);

        if(matcher.find()){
            pageId = matcher.group().split("pageId=")[1];
        }

        return pageId;
    }
}